/*
 ------------------------------------------------------------------------------
 Copyright (C) 2013 Eternal Games.

 This file is part of the GLQuake source code.

 The GLQuake source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The GLQuake source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the GLQuake source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


//
// cg_fx.cpp - FX definition parsing and loading
//


#include "cg_local.h"


#define FXS_HASH_SIZE					(MAX_FXS >> 2)

static fx_t					cg_parseFX;
static fxAction_t			cg_parseFXActions[MAX_FX_ACTIONS];

static fx_t *				cg_fxsHashTable[FXS_HASH_SIZE];
static fx_t *				cg_fxs[MAX_FXS];
static int					cg_numFXs;


/*
 ==============================================================================

 FX LOADING

 ==============================================================================
*/


/*
 ==================
 
 ==================
*/
fx_t *CG_RegisterFX (const char *name){

	return NULL;
}


/*
 ==============================================================================

 CONSOLE COMMANDS

 ==============================================================================
*/


/*
 ==================
 
 ==================
*/
void CG_ListFXs_f (){

}

/*
 ==================
 
 ==================
*/
void CG_ReloadFX_f (){

}


/*
 ==============================================================================

 DEFAULT FXS

 ==============================================================================
*/


/*
 ==================
 
 ==================
*/
void CG_CreateDefaultFXs (){

}


/*
 ==============================================================================

 INITIALIZATION & SHUTDOWN

 ==============================================================================
*/


/*
 ==================
 CG_InitFXs
 ==================
*/
void CG_InitFXs (){

	G_Printf("Initializing FXs\n");

	// Add commands
	glqCmdSystem->AddCommand("listFXs", CG_ListFXs_f, "Lists loaded FXs", NULL);
	glqCmdSystem->AddCommand("reloadFX", CG_ReloadFX_f, "Reloads an FX", glqCmdSystem->ArgCompletion_FXName);

	// Create the default FXs
	CG_CreateDefaultFXs();

	// Register the FX definition type
	glqDefManager->RegisterType(DEF_FX, "FX", "fxs", ".fx", "listFXDefs", "printFXDef");

	// Load all the FX definitions
	glqDefManager->LoadDefs(DEF_FX, true);
}

/*
 ==================
 CG_ShutdownFXs
 ==================
*/
void CG_ShutdownFXs (){

	// Remove commands
	glqCmdSystem->RemoveCommand("listFXs");
	glqCmdSystem->RemoveCommand("reloadFX");

	// Purge all the FX definitions
	glqDefManager->PurgeDefs(DEF_FX);

	// Clear FX list
	glqMemory->Fill(cg_fxsHashTable, 0, sizeof(cg_fxsHashTable));
	glqMemory->Fill(cg_fxs, 0, sizeof(cg_fxs));

	cg_numFXs = 0;
}